import request from '@/utils/request'

export function getAll(params) {
  return request({
    url: '/blood',
    method: 'get',
    params,
  })
}

export function getCensus(params) {
  return request({
    url: '/blood/census',
    method: 'get',
    params,
  })
}

export function getOne(blood_id) {
  return request({
    url: '/blood/' + blood_id,
    method: 'get',
  })
}

export function addOne(data) {
  return request({
    url: '/blood',
    method: 'post',
    data,
  })
}

export function updateOne(blood_id, data) {
  return request({
    url: '/blood/' + blood_id + '/modify',
    method: 'patch',
    data,
  })
}

export function deleteOne(blood_id) {
  return request({
    url: '/blood/' + blood_id,
    method: 'delete',
  })
}

export function multiSave(datas) {
  return request({
    url: '/blood/multiSave',
    method: 'post',
    data: { datas },
  })
}

export function doPre(blood_id, pre_data) {
  return request({
    url: `/blood/${blood_id}/pre`,
    method: 'post',
    data: { pre_data },
  })
}

export function doSub(blood_id, sub_data) {
  return request({
    url: `/blood/${blood_id}/sub`,
    method: 'post',
    data: { sub_data },
  })
}

export function doSync(ids) {
  return request({
    url: `/blood/sync`,
    method: 'post',
    data: { ids },
  })
}

export function doPrint(id) {
  return request({
    url: `/blood/${id}/print`,
    method: 'post',
  })
}

export function doPrints(data) {
  return request({
    url: `/blood/prints`,
    method: 'post',
    data,
  })
}

export function doModify(id, data) {
  return request({
    url: `/blood/${id}/modify`,
    method: 'patch',
    data,
  })
}

export function doFetch(data) {
  return request({
    url: '/blood/fetch',
    method: 'post',
    data,
  })
}

export function all(ids) {
  return request({
    url: '/blood/all',
    method: 'post',
    data: { ids },
  })
}
